# Maintainer: David Runge <dvzrv@archlinux.org>

_name=python3-openid
pkgname=python-openid
pkgver=3.2.0
pkgrel=6
pkgdesc="Python 3 port of the python2-openid library"
arch=('any')
url="https://github.com/necaris/python3-openid"
license=('Apache')
depends=('python-defusedxml')
makedepends=('python-setuptools')
checkdepends=('python-coverage' 'python-django' 'python-httplib2'
'python-mysqlclient' 'python-psycopg2' 'python-pycurl' 'python-pytest')
source=("https://files.pythonhosted.org/packages/source/${_name::1}/${_name}/${_name}-${pkgver}.tar.gz")
sha512sums=('54412820fef21928e1bf30d16c9bc73d454e9ff41df028a12047c08abdb4c2c9e1d9053daebab8b0327cb0fe0f67e364c2506a47509fef6db5bff42f8399b799')

prepare() {
  mv -v "${_name}-${pkgver}" "$pkgname-$pkgver"
}

build() {
  cd "$pkgname-$pkgver"
  python setup.py build
}

check() {
  cd "$pkgname-$pkgver"
  export PYTHONPATH="build:${PYTHONPATH}"
  coverage run -m unittest openid.test.test_suite
}

package() {
  cd "$pkgname-$pkgver"
  python setup.py install --skip-build \
    --optimize=1 \
    --prefix=/usr \
    --root="${pkgdir}"
  install -vDm 644 NEWS.md -t "${pkgdir}/usr/share/doc/${pkgname}"
}
